package svc

import (
	"api/internal/config"
	"cart_srv/cartsrvclient"
	"github.com/zeromicro/go-zero/zrpc"
	"goods_srv/goodssrvclient"
)

type ServiceContext struct {
	Config   config.Config
	GoodsSrv goodssrvclient.GoodsSrv
	CartSrv  cartsrvclient.CartSrv
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		GoodsSrv: goodssrvclient.NewGoodsSrv(zrpc.MustNewClient(c.GoodsSrv)),
		CartSrv:  cartsrvclient.NewCartSrv(zrpc.MustNewClient(c.CartSrv)),
	}
}
